from contextlib import contextmanager
from typing import Any, Dict

from django.conf import settings
from rest_framework.settings import APISettings, perform_import

CHATGPT_DEFAULTS: Dict[str, Any] = {
    # api_key
    'API_KEY': '',
    # 返回数据量
    'MAX_TOKENS': 10,
    # 工作线程数
    'THREADS': 1,
    # 温度
    'TEMPERATURE': 0.5,
}

class ChatGptSettings(APISettings):
    pass

chatgpt_settings = ChatGptSettings(
    user_settings=getattr(settings,'CHATGPT_SETTINGS',{}),
    defaults=CHATGPT_DEFAULTS
)
